package com.tommy.ddp.manager
{
	import com.tommy.ddp.definition.BoxExeType;
	import com.tommy.ddp.disposeHandler.IDisposeHandler;
	import com.tommy.ddp.disposeHandler.special.DisposeAllBoxHandler;
	import com.tommy.ddp.disposeHandler.special.DisposeAllColorHandler;
	import com.tommy.ddp.disposeHandler.special.DisposeAllColorWithXYHandler;
	import com.tommy.ddp.disposeHandler.special.DisposeBigBangHandler;
	import com.tommy.ddp.disposeHandler.special.DisposeCrossHandler;
	import com.tommy.ddp.disposeHandler.special.ISpecialDisposeHandler;
	
	import org.taomee.ds.HashMap;

	public class SpecialDisposeManager
	{
		private static var hashMap:HashMap;
		
		public function SpecialDisposeManager()
		{
		}
		
		setup();
		private static function setup():void
		{
			hashMap = new HashMap();
			addHandler(BoxExeType.SUPER_BOOM,BoxExeType.NONE,DisposeAllColorHandler);
			addHandler(BoxExeType.SUPER_BOOM,BoxExeType.Y_AXIS_ALL,DisposeAllColorWithXYHandler);
			addHandler(BoxExeType.SUPER_BOOM,BoxExeType.X_AXIS_ALL,DisposeAllColorWithXYHandler);
			addHandler(BoxExeType.SUPER_BOOM,BoxExeType.BOOM,DisposeAllColorHandler);
			addHandler(BoxExeType.SUPER_BOOM,BoxExeType.SUPER_BOOM,DisposeAllBoxHandler);
			addHandler(BoxExeType.X_AXIS_ALL,BoxExeType.Y_AXIS_ALL,DisposeCrossHandler);
			addHandler(BoxExeType.BOOM,BoxExeType.Y_AXIS_ALL,DisposeBigBangHandler);
			addHandler(BoxExeType.BOOM,BoxExeType.X_AXIS_ALL,DisposeBigBangHandler);
			//
			addHandler(BoxExeType.X_AXIS_ALL,BoxExeType.X_AXIS_ALL,DisposeCrossHandler);
			addHandler(BoxExeType.Y_AXIS_ALL,BoxExeType.Y_AXIS_ALL,DisposeCrossHandler);
			
		}
		
		private static function addHandler(exeType1:uint,exeType2:uint,cls:Class):void
		{
			hashMap.add(exeType1+"_"+exeType2,cls);
		}
		
		
		public static function getIsSpecial(str:String):ISpecialDisposeHandler
		{
			var cls:Class = hashMap.getValue(str);
			if(cls)
				return new cls();
			else
				return null;
		}
	}
}